package vip.xiaonuo.modular.controller;

import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.annotion.Permission;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.core.pojo.response.ResponseData;
import vip.xiaonuo.core.pojo.response.SuccessResponseData;
import vip.xiaonuo.modular.entity.Luqu;
import vip.xiaonuo.modular.param.LuquParam;
import vip.xiaonuo.modular.service.LuquService;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.List;

/**
 * 录取管理控制器
 *
 * @author 春非昔日春
 * @date 2023-02-28 13:29:27
 */
@Controller
public class LuquController {

    private String PATH_PREFIX = "luqu/";

    @Resource
    private LuquService luquService;

    /**
     * 录取管理页面
     *
     * @author 春非昔日春
     * @date 2023-02-28 13:29:27
     */
    @Permission
    @GetMapping("/luqu/index")
    public String index() {
        return PATH_PREFIX + "index.html";
    }

    /**
     * 录取管理表单页面
     *
     * @author 春非昔日春
     * @date 2023-02-28 13:29:27
     */
    @GetMapping("/luqu/form")
    public String form() {
        return PATH_PREFIX + "form.html";
    }


    @GetMapping("/luqu/select")
    public String select() {
        return PATH_PREFIX + "select.html";
    }
    /**
     * 查询录取管理
     *
     * @author 春非昔日春
     * @date 2023-02-28 13:29:27
     */
    @Permission
    @ResponseBody
    @GetMapping("/luqu/page")
    @BusinessLog(title = "录取管理_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public PageResult<Luqu> page(LuquParam luquParam) {
        return luquService.page(luquParam);
    }

    /**
     * 添加录取管理
     *
     * @author 春非昔日春
     * @date 2023-02-28 13:29:27
     */
    @Permission
    @ResponseBody
    @PostMapping("/luqu/add")
    @BusinessLog(title = "录取管理_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(LuquParam.add.class) LuquParam luquParam) {
        luquService.add(luquParam);
        return new SuccessResponseData();
    }

    /**
     * 删除录取管理
     *
     * @author 春非昔日春
     * @date 2023-02-28 13:29:27
     */
    @Permission
    @ResponseBody
    @PostMapping("/luqu/delete")
    @BusinessLog(title = "录取管理_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(LuquParam.delete.class) List<LuquParam> luquParamList) {
        luquService.delete(luquParamList);
        return new SuccessResponseData();
    }

    /**
     * 编辑录取管理
     *
     * @author 春非昔日春
     * @date 2023-02-28 13:29:27
     */
    @Permission
    @ResponseBody
    @PostMapping("/luqu/edit")
    @BusinessLog(title = "录取管理_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(LuquParam.edit.class) LuquParam luquParam) {
        luquService.edit(luquParam);
        return new SuccessResponseData();
    }

    /**
     * 查看录取管理
     *
     * @author 春非昔日春
     * @date 2023-02-28 13:29:27
     */
    @Permission
    @ResponseBody
    @GetMapping("/luqu/detail")
    @BusinessLog(title = "录取管理_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(LuquParam.detail.class) LuquParam luquParam) {
        return new SuccessResponseData(luquService.detail(luquParam));
    }

    /**
     * 录取管理列表
     *
     * @author 春非昔日春
     * @date 2023-02-28 13:29:27
     */
    @Permission
    @ResponseBody
    @GetMapping("/luqu/list")
    @BusinessLog(title = "录取管理_列表", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(LuquParam luquParam) {
        return new SuccessResponseData(luquService.list(luquParam));
    }

}
